<?php

/**
 * Date class.
 *
 *
 * @package    lib
 * @subpackage lib_svn
 * @author     Juan Carlos Jarquin (zetta)
 * @author     $LastChangedBy$
 * @version    0.2, SVN: $Id$
 */

class Date
{
  
  /**
   * @var string
   */
  private $svnDate = "";
  
  /**
   * Class Constructor
   *
   * @param string $date
   * @return Date
   */
  public function Date($date)
  {
    $this->svnDate = trim($date);
  }
  
  /**
   * ToString
   * @return string
   */
  public function __toString()
  {
    return $this->getString('M d, Y');
  }
  
  /**
   * Get the Formatted string
   * @param string $format
   * @return string
   */
  public function getString($format)
  {
    $date = $this->svnDate;
    $date = eregi_replace("\\([A-Z][a-z]{1,4}, [0-9]{2} [A-Z][a-z]{1,4} [0-9]{4}\\)$", '', $date);
    $time = strtotime($date);
    return date($format, $time);
  }

}